package com.zb.sannuo.personal.controller;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.zb.sannuo.common.domain.SccUserLogin;
import com.zb.sannuo.common.domain.vo.UserLogin;
import com.zb.sannuo.common.result.Result;
import com.zb.sannuo.common.result.ResultCode;
import com.zb.sannuo.common.util.PasswordUtil;
import com.zb.sannuo.personal.service.PersonalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

@RestController
@Cacheable
@RequestMapping("/login")
@Api(tags = "用户信息模块",description = "对用户信息模块进行CRUD操作")
public class PersonalController {

    @Resource
    private PersonalService personalServiceImpl;


    //修改密码
    @RequestMapping(value = "password",method = RequestMethod.POST)
    @ApiOperation(value = "修改密码",notes = "修改密码",httpMethod = "POST")
    public Result trueStatus(UserLogin userLogin) throws Exception{
        System.out.println(userLogin);
        int i = personalServiceImpl.updatePassword(userLogin);
        if (i>0){
            return Result.ok(ResultCode.SUCCESS,i);
        }else{
            return Result.fail(ResultCode.FAIL,null);
        }
    }

}
